home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
mig
/
Mig.man
< prev
next >
Wrap
Text File
|
1990-02-28
|
10KB
|
219 lines
\fB'\" $Header: /sprite/src/lib/c/mig/RCS/Mig.man,v 1.2 90/02/28 11:00:30 douglis Exp $ SPRITE (Berkeley)
.so \*(]ltmac.sprite
.HS Mig lib
.BS
.SH NAME
Mig \- obtain or update information in the migration information database.
.SH SYNOPSIS
.nf
\fB#include <mig.h>\fR
Mig_Info *
\fBMig_GetInfo\fR(\fIspriteID\fP)
int
\fBMig_GetAllInfo\fR(\fIinfoArray, numHosts\fP)
int
\fBMig_RequestIdleHosts\fR(\fInumHosts, priority, flags, callBackPtr, hostArray\fP)
int
\fBMig_ConfirmIdle\fR(\fIspriteID\fP)
int
\fBMig_ReturnHosts\fR(\fInumHosts, hostArray\fP)
int
\fBMig_DeleteHost\fR(\fIspriteID\fP)
int
\fBMig_Evict\fR()
char *
\fBMig_GetPdevName\fR(\fIglobal\fP)
int
\fBMig_GetIdleNode\fR()
int
\fBMig_Done\fR(\fIspriteID\fP)
.SH ARGUMENTS
.AS void (*callBackPtr)() in
.AP int spriteID in
The Sprite ID of the host for which information should be obtained or updated.
.AP Mig_Info infoArray[] out
A buffer to hold Mig_Info entries returned by the Mig_GetAllInfo routine.
The size of the buffer is specified in the \fInumHosts\fP variable.
.AP int numHosts in
The number of Mig_Info structures contained in \fIinfoArray\fP.
Or, the number of hosts requested from \fBMig_RequestIdleHosts\fR and
the number of hosts returned to \fBMig_ReturnIdle\fR.
.AP int priority in
Priority of processes to be migrated to idle hosts (see below).
.AP int flags in
Flags to be passed to the migration daemon (see below).
.AP void (*callBackPtr)() in
Routine to call if not enough hosts are available and
additional hosts are later available.
.AP int global in
Whether to return the name of the pseudo-device for the global daemon
or host-specific daemon.
.BE
.SH DESCRIPTION
These functions are used to obtain (or update) information about hosts on the
Sprite network. There are routines to get information about specific
hosts or all the hosts on the network, to select one or more idle hosts for
process migration, to cause processes to be evicted, or to remove
hosts that are down from the list of hosts on the network.
.PP
Most of the routines interact with a single network-wide daemon, known
as the \fIglobal daemon\fP, to obtain information or make requests.
This \fBmigd\fP daemon maintains state about all hosts on the network,
including their load averages, idle time, and availability for use
with migration. In addition, each host runs a per-host instance of
\fBmigd\fR that samples load and evicts processes automatically when
it detects user input. The \fBMig\fR library opens a pseudo-device
to communicate with the appropriate \fBmigd\fR daemon (global or
local) depending on the operation being performed. Also, if an error
occurs communicating with a daemon, the \fBMig\fR library
reestablishes communication.
.SH GETTING HOST INFORMATION
The migration daemon, and the migration library, communicate using a
structure defined in mig.h, known as a Mig_Info structure.
Each host has a Mig_Info structure associated with it. The structure
has another structure included within it; the Mig_LoadVector is
updated periodically by the \fBmigd\fR process on each host. The rest
of the data in a Mig_Info structure are established at boot-time or are
maintained by the global daemon.
.PP
The global daemon maintains the state of each host. The states are
defined in mig.h. The most important ones are MIG_HOST_DOWN, which
indicates that the rest of the Mig_Info structure is irrelevant with
the exception of loadVec.timestamp, which indicates when the host was
last up; MIG_HOST_IDLE, indicating that a host is available for
migration; MIG_HOST_FULL, which shows that the host is accepting
migration but already has foreign processes; and MIG_HOST_ACTIVE,
which indicates that a user is actively using the machine or the
machine's load is too high to permit foreign processes.
.PP
The load vector includes weighted
average CPU utilizations and ready-queue lengths, as well as the time since
input was last received from users directly logged into the machine. (Remote
logins do not affect idle time.) Finally, each entry indicates whether the
host is willing to accept processes for migration. \fBmigd\fR
is responsible for determining whether migration
is allowed, based on factors such as load and idle time.
.PP
\fBMig_GetInfo()\fR returns a pointer to a Mig_Info structure based on the sprite
ID of a host.
The structure is statically allocated by Mig_GetInfo, and the contents of
the structure may change on subsequent calls to Mig_GetInfo. On
error, a NULL pointer is returned.
.PP
\fBMig_GetAllInfo()\fR returns an array of Mig_Info structures. The array
must be allocated by the caller, and a pointer to the array must be
passed to \fBMig_GetAllInfo()\fR, along with the size of the array. The
number of entries filled in \fiinfoArray\fP is returned. On error, -1
is returned and the global variable \fIerrno\fP indicates the nature
of the error.
.PP
.SH GETTING IDLE HOSTS
The global daemon maintains open connections to both per-host
\fBmigd\fR daemons and user processes that are using idle hosts. User
processes can request idle hosts using any of three priorities,
MIG_LOW_PRIORITY, MIG_NORMAL_PRIORITY, and MIG_HIGH_PRIORITY.
MIG_LOW_PRIORITY is for long-running background processes that are to
be run at low execution priority. MIG_NORMAL_PRIORITY is for normal,
relatively short-lived processes such as compiles. MIG_HIGH_PRIORITY
is not yet in general use. Hosts with foreign processes of one
priority can still accept more processes of higher priority, so
simulations won't interfere with compiles.
.PP
Processes communicate with the global daemon using ioctls, and
normally, those streams are
not readable.
The global daemon makes the streams readable to indicate that a change
of state has occurred. The \fBMig\fR library
relies on \fBselect()\fR to determine whether the global daemon has
information about changes. In this way, communication with the daemon
may be minimized, since applications can check for new idle hosts or
evictions on hosts they were using, without ever communicating with
the daemon.
.PP
\fBMig_RequestIdleHosts()\fR requests one or more idle hosts from the
global daemon. The number of hosts available is returned. The
\fIpriority\fR must be specified as one of the priorities listed
above. The \fIflags\fR may be 0 or MIG_PROC_AGENT, which indicates
that the process requesting the host will not indicate when the
processes being migrated are through, and instead the hosts to which
the processes are migrated should monitor foreign processes and note
when they are no longer in use for migration. The \fIcallBackPtr\fR
may be NULL or a pointer to a void function that will be invoked when
additional hosts are available, if an insufficient number of hosts are
granted by the global daemon at the time of the call. \fIhostArray\fR
points to an area that can hold up to \fInumHosts\fR host identifiers.
.PP
\fBMig_ConfirmIdle(\fIhostID\fB)\fR verifies that a host is still
available. If
the host is available,
\fBMig_ConfirmIdle()\fR returns 1 (TRUE). If the host is not
available, or an error occurs, \fBMig_ConfirmIdle()\fR returns 0 (FALSE).
In this case, the caller may request a new idle host.
.PP
\fBMig_ReturnHosts()\fR returns one or more idle hosts to the pool.
Note: all hosts requested by a process are returned to the pool of
idle hosts when the stream that connects the process to the global
daemon is closed (i.e., when the process and all its children that may
have inherited the stream have exited).
.SH BACKWARD COMPATIBILITY
Two functions are implemented to provide a backward compatible
interface for users of the original \fBMig\fR library.
.PP
\fBMig_GetIdleNode()\fR returns the number of an idle node. If no host is
available, then 0 is returned. On error, -1
is returned and the global variable \fIerrno\fP indicates the nature
of the error.
.PP
\fBMig_Done()\fR returns a single host to the pool of idle hosts.
.SH MISCELLANEOUS
.PP
\fBMig_DeleteHost()\fR removes a host from the database maintained by
the global daemon. The host must be down at the time. This may be used
if a host is removed from the network or renamed.
.PP
\fBMig_Evict()\fR performs an \fIioctl\fP to the local \fBmigd\fR
daemon, requesting that it evict any foreign processes. Normally,
eviction is automatic when a host becomes active after being idle.
This routine provides the \fBloadavg\fP program with the ability to
request evictions at other times (for example, from a remote login).
.PP
\fBMig_GetPdevName()\fR is used by the migration library and by
\fBmigd\fR to get the name of pseudo-devices to open. It would not
normally be used by other programs.
.SH DIAGNOSTICS
Most \fBMig\fR routines
return zero if
all went well. Otherwise
they return -1 and the \fIerrno\fR variable contains additional information
about what error occurred. \fBMig_GetIdleNode()\fR and
\fBMig_RequestIdleHosts()\fR similarly return -1 on
error, but they return 0 if no idle host is available. \fBMig_GetInfo()\fR
returns
NULL on error.
.SH FILES
.IP /sprite/admin/migd.log
The global migration daemon error log.
.IP /hosts/$HOST/migd.log
The error log used by host $HOST.
.IP /sprite/admin/migInfo.pdev
The pseudo-device used to communicate with the global daemon.
.IP /hosts/$HOST/migInfo.pdev
The pseudo-device used to communicate with the local daemon.
.IP /sprite/admin/migd.check
The file used to store the most recent information about host uptimes.
.SH KEYWORDS
migration, load average, idle time, pseudo-device, eviction
.SH SEE ALSO
migd, loadavg, pmake, pdev